package letsjava.hibernate;

import java.util.Date;

import org.hibernate.Session;


public class EventManager {
	public static void main(String[] args) {
		EventManager mgr = new EventManager();

		mgr.save("222");

		HibernateUtil.getSessionFactory().close();
	}

	private void save(String title) {

		Session session = HibernateUtil.getSessionFactory().getCurrentSession();

		session.beginTransaction();

		Event theEvent = new Event();
		theEvent.setTitle(title);
		//theEvent.setId((long) 111);
		session.save(theEvent);

		session.getTransaction().commit();
	}

}
